using System;
using System.Data;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace CatalogManager.CatalogForms
{
	/// <summary>
	/// Summary description for LanguageSelector.
	/// </summary>
	public class LanguageSelector : System.Windows.Forms.Form
	{
		public DataSet Languages=null;
		private System.Windows.Forms.Button btnAdd;
		private System.Windows.Forms.Button btnCancel;
		public System.Windows.Forms.CheckedListBox LanguagecheckedListBox;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public LanguageSelector()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.LanguagecheckedListBox = new System.Windows.Forms.CheckedListBox();
			this.btnAdd = new System.Windows.Forms.Button();
			this.btnCancel = new System.Windows.Forms.Button();
			this.SuspendLayout();
			// 
			// LanguagecheckedListBox
			// 
			this.LanguagecheckedListBox.CheckOnClick = true;
			this.LanguagecheckedListBox.Location = new System.Drawing.Point(8, 8);
			this.LanguagecheckedListBox.Name = "LanguagecheckedListBox";
			this.LanguagecheckedListBox.Size = new System.Drawing.Size(312, 319);
			this.LanguagecheckedListBox.TabIndex = 0;
			// 
			// btnAdd
			// 
			this.btnAdd.Location = new System.Drawing.Point(88, 336);
			this.btnAdd.Name = "btnAdd";
			this.btnAdd.TabIndex = 1;
			this.btnAdd.Text = "Add";
			this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
			// 
			// btnCancel
			// 
			this.btnCancel.Location = new System.Drawing.Point(176, 336);
			this.btnCancel.Name = "btnCancel";
			this.btnCancel.TabIndex = 2;
			this.btnCancel.Text = "Cancel";
			this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
			// 
			// LanguageSelector
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(328, 366);
			this.Controls.AddRange(new System.Windows.Forms.Control[] {
																		  this.btnCancel,
																		  this.btnAdd,
																		  this.LanguagecheckedListBox});
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
			this.MaximizeBox = false;
			this.Name = "LanguageSelector";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "LanguageSelector";
			this.Load += new System.EventHandler(this.LanguageSelector_Load);
			this.ResumeLayout(false);

		}
		#endregion

		private void btnCancel_Click(object sender, System.EventArgs e)
		{
			this.Close();
		}

		private void btnAdd_Click(object sender, System.EventArgs e)
		{
			// add language to server
			this.Close();
		}

		private void LanguageSelector_Load(object sender, System.EventArgs e)
		{
			foreach(DataRow dr in Languages.Tables[0].Rows)
			{
				LanguagecheckedListBox.Items.Add(dr["display_name"].ToString());
			}
		}
	}
}
